Sometimes, with arrays, we want to test every element for a certain condition. While individual conditions can be tested easily with an statement, it becomes trickier with multiple array elements. As such, Javascript provides a method on arrays called which will test every element for a specific test. If all pass the test, the overall method will pass . If one or more fail the test, then the overall method will return . if every every true every false Checking every element of an array for a test Suppose we have an array where we want to test if every number is above 15. This is a perfect place to use . Let's take a look. every let arr = [ 25, 35, 45, 55, 65 ]; let check = arr.every((el, index, array) => { return el > 15 }); console.log(check); // true takes a function like . every (el, index, array) => ... is the current element being iterated through by . el every is the index of the current element being iterated through by the array. index is the full array being iterated upon. Here it would be . array [ 25, 35, 45, 55, 65 ] Since arrow functions will return true if on one line without a statement, the above code can be simplified to this, too: return let arr = [ 25, 35, 45, 55, 65 ]; let check = arr.every((el, index, array) => el > 15); console.log(check); // true Furthermore, the method can take another form where it accepts a callback function's name, along with a custom value for . That means you can create a function, and then prep its content based on a custom within the function itself. For example, below I pass into , allowing us to change this value should we want to for other times when we call : every this this {value: 15} this every let callbackFn = function(el) { if(this.value !== undefined) { return el > this.value } return false; } let arr = [ 25, 35, 45, 55, 65 ]; let check = arr.every(callbackFn, { value: 15 }); // Returns true Modifying an array with the every method Much like other array methods, Javascript does allow modification of the array within a method called upon it. For example, we could modify each element of our array and then do a check on it. Since is essentially a type of loop, each element is looped over sequentially: every let arr = [ 25, 35, 45, 55, 65 ]; let check = arr.every((el, index, array) => { arr[index] -= 100; return el > 5 }); // This is true, since we subtracted 100 from each element before the check console.log(check); // true We can even delete elements from an array in the loop: every let arr = [ 25, 35, 45, 55, 65 ]; let check = arr.every((el, index, array) => { arr.pop(); return el > 15; }); console.log(arr); // returns [ 25, 35 ] Javascript even lets you add elements to an array in . Since fires only once for each element in an array, it cannot lead to an infinite loop by simply pushing elements to the original array: every every let arr = [ 25, 35, 45, 55, 65 ]; let check = arr.every((el, index, array) => { arr.push(100); return el > 15; }); // This is true, since we subtracted 100 from each element before the check console.log(arr); // returns [25, 35, 45, 55, 65, 100, 100, 100, 100, 100] console.log(check); // returns true Conclusion The method is a built-in way to carry out logical tests on entire arrays. You should be careful with this on large arrays as it may lead to performance problems. In most cases, though, it's a really useful tool to add to your array arsenal. There are many other use cases where is very useful. For example, you can also use to . every every every check if an array is a subset of another array Also published here.